import fetch from '../utils/fetch.js'
import {Api},Actions from '../constants'

// const uid = () => Math.random().toString(34).slice(2);



function sendPost(payload){
    return {
        type:Actions.REQUEST_ROBOT,
        payload
    }
}
function sendPostSuccess(answer){
    return {
        type:Actions.RECEIVE_ROBOT,
        answer
    }
}
export function postQuestion(){
    return (dispatch, getState) => {
        return fetch(Api.communion,{method:'POST'})
            .then(json => {
                dispatch(sendPostSuccess(json))
            })
            .catch(err => {
                // dispatch(sendPost({loading:false}))
            })
    }
}
